#include "../server.hpp"
#include <iostream>



void test1(){
    Buffer buff;
    std::string str = "hello!!";
    buff.write_string_and_push(str);
    std::string tmp;
    tmp = buff.read_as_string_and_pop(buff.readable_size());
    std::cout << tmp << std::endl;
    std::cout << buff.readable_size() << std::endl;
}

void testget_line(){
    Buffer buff;
    std::string str = "hello!!\nI'm Li Hua\nli hao";
    buff.write_string_and_push(str);
    std::string tmp;
    std::cout << buff.readable_size() << std::endl;

    // hello!!
    tmp = buff.get_line_and_pop();
    std::cout << tmp << std::endl;
    std::cout << buff.readable_size() << std::endl;

    // I'm Li Hua
    tmp = buff.get_line_and_pop();
    std::cout << tmp << std::endl;
    std::cout << buff.readable_size() << std::endl;

    //
    tmp = buff.get_line_and_pop();
    std::cout << tmp << std::endl;
    std::cout << buff.readable_size() << std::endl;

}

int main(){
    std::cout << "1----\n";
    test1();
    std::cout << "2----\n";
    testget_line();
    return 0;
}